package org.embedchat.protocol.message.client;

import org.embedchat.protocol.message.AbstractMessage;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class RoomsListRequestMessage extends AbstractMessage {

	private static final long serialVersionUID = 7402809871804957870L;
	
	private String requestString;
	
	public String getRequestString() {
		return requestString;
	}

	public void setRequestString(String requestString) {
		this.requestString = requestString;
	}

	@Override
	public int getMessageBodyLength() {
		return requestString.getBytes().length;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append("requestString", requestString)
				.toString();
	}

	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof RoomsListRequestMessage))
			return false;
		RoomsListRequestMessage castOther = (RoomsListRequestMessage) other;
		return new EqualsBuilder().append(requestString,
				castOther.requestString).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(requestString).toHashCode();
	}
}
